import React from 'react'
import { push } from 'react-router-redux'
import { connect } from 'react-redux'




@connect(
  state => ({user: state.auth.user}),
  { pushState: push } )
export default class GamePostCell extends React.Component {
  
  constructor(props) {
    super(props);
    this.handleOnClick = this._handleOnClick.bind(this);
  }

  _handleOnClick (post_id) {
    // e.preventDefault()
  	console.log('pushing')
  	this.props.pushState('/GamePostDisplay' + '/' + post_id)
  }

  render() {

  	const { single_game_post } = this.props;

    var red = {color: 'red'};
    
    return (
      <div>
        <div className="container">

          <h5 className="col-lg-3">
          This Post's comments number: {single_game_post._comments.length}</h5>
      
          <h5 className="col-lg-3">
          Post_id: {single_game_post._id}</h5>
          
          <h5 className="col-lg-3" style = {red} onClick={ () => this.handleOnClick(single_game_post._id)}>
          content( 点我看帖 ): {single_game_post.content}</h5>          

        </div>
      </div>
    )
  }

}



